/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package economicocontrol.dao.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author iMac
 */
@Entity
@Table(name = "registro_personal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RegistroPersonal.findAll", query = "SELECT r FROM RegistroPersonal r"),
    @NamedQuery(name = "RegistroPersonal.findByIdRegistroPersonal", query = "SELECT r FROM RegistroPersonal r WHERE r.idRegistroPersonal = :idRegistroPersonal"),
    @NamedQuery(name = "RegistroPersonal.findByNombrePersonal", query = "SELECT r FROM RegistroPersonal r WHERE r.nombrePersonal = :nombrePersonal"),
    @NamedQuery(name = "RegistroPersonal.findByApellidoPaterno", query = "SELECT r FROM RegistroPersonal r WHERE r.apellidoPaterno = :apellidoPaterno"),
    @NamedQuery(name = "RegistroPersonal.findByApellidoMaterno", query = "SELECT r FROM RegistroPersonal r WHERE r.apellidoMaterno = :apellidoMaterno"),
    @NamedQuery(name = "RegistroPersonal.findBybuscar", query = "SELECT r FROM RegistroPersonal r WHERE r.nombrePersonal like :nombrePersonal"),
    @NamedQuery(name = "RegistroPersonal.findBybuscarNomApells", query = "SELECT r FROM RegistroPersonal r WHERE r.nombrePersonal = :nombrePersonal and r.apellidoPaterno = :apellidoPaterno and r.apellidoMaterno = :apellidoMaterno")})
public class RegistroPersonal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idRegistro_Personal")
    private Integer idRegistroPersonal;
    @Column(name = "Nombre_Personal")
    private String nombrePersonal;
    @Column(name = "Apellido_Paterno")
    private String apellidoPaterno;
    @Column(name = "Apellido_Materno")
    private String apellidoMaterno;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "registroPersonalidRegistroPersonal")
    private Collection<RegistroEconomicos> registroEconomicosCollection;
    @JoinColumn(name = "Registro_Departamentos_Id_RegistroDepartamento", referencedColumnName = "Id_RegistroDepartamento")
    @ManyToOne(optional = false)
    private RegistroDepartamentos registroDepartamentosIdRegistroDepartamento;
    @JoinColumn(name = "Status_Personal_idStatusPer", referencedColumnName = "idStatusPer")
    @ManyToOne(optional = false)
    private StatusPersonal statusPersonalidStatusPer;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "registroPersonalidRegistroPersonal")
    private Collection<RegistroEntradaSalida> registroEntradaSalidaCollection;

    public RegistroPersonal() {
    }

    public RegistroPersonal(Integer idRegistroPersonal) {
        this.idRegistroPersonal = idRegistroPersonal;
    }

    public Integer getIdRegistroPersonal() {
        return idRegistroPersonal;
    }

    public void setIdRegistroPersonal(Integer idRegistroPersonal) {
        this.idRegistroPersonal = idRegistroPersonal;
    }

    public String getNombrePersonal() {
        return nombrePersonal;
    }

    public void setNombrePersonal(String nombrePersonal) {
        this.nombrePersonal = nombrePersonal;
    }

    public String getApellidoPaterno() {
        return apellidoPaterno;
    }

    public void setApellidoPaterno(String apellidoPaterno) {
        this.apellidoPaterno = apellidoPaterno;
    }

    public String getApellidoMaterno() {
        return apellidoMaterno;
    }

    public void setApellidoMaterno(String apellidoMaterno) {
        this.apellidoMaterno = apellidoMaterno;
    }

    @XmlTransient
    public Collection<RegistroEconomicos> getRegistroEconomicosCollection() {
        return registroEconomicosCollection;
    }

    public void setRegistroEconomicosCollection(Collection<RegistroEconomicos> registroEconomicosCollection) {
        this.registroEconomicosCollection = registroEconomicosCollection;
    }

    public RegistroDepartamentos getRegistroDepartamentosIdRegistroDepartamento() {
        return registroDepartamentosIdRegistroDepartamento;
    }

    public void setRegistroDepartamentosIdRegistroDepartamento(RegistroDepartamentos registroDepartamentosIdRegistroDepartamento) {
        this.registroDepartamentosIdRegistroDepartamento = registroDepartamentosIdRegistroDepartamento;
    }

    public StatusPersonal getStatusPersonalidStatusPer() {
        return statusPersonalidStatusPer;
    }

    public void setStatusPersonalidStatusPer(StatusPersonal statusPersonalidStatusPer) {
        this.statusPersonalidStatusPer = statusPersonalidStatusPer;
    }

    @XmlTransient
    public Collection<RegistroEntradaSalida> getRegistroEntradaSalidaCollection() {
        return registroEntradaSalidaCollection;
    }

    public void setRegistroEntradaSalidaCollection(Collection<RegistroEntradaSalida> registroEntradaSalidaCollection) {
        this.registroEntradaSalidaCollection = registroEntradaSalidaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRegistroPersonal != null ? idRegistroPersonal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RegistroPersonal)) {
            return false;
        }
        RegistroPersonal other = (RegistroPersonal) object;
        if ((this.idRegistroPersonal == null && other.idRegistroPersonal != null) || (this.idRegistroPersonal != null && !this.idRegistroPersonal.equals(other.idRegistroPersonal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "economicocontrol.dao.entity.RegistroPersonal[ idRegistroPersonal=" + idRegistroPersonal + " ]";
    }
    
}
